package com.hongkuncheng.cms.freemaker.string;

import java.util.List;

import org.springframework.stereotype.Component;
import com.hongkuncheng.cms.helper.StringHelper;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

@Component
public class SubstringMethod implements TemplateMethodModelEx {

    @Override
    public Object exec(List args) throws TemplateModelException {
        return StringHelper.substring(args.get(0).toString(), Integer.parseInt(args.get(1).toString()));
    }

}
